home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_lag_shipdoorlock.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  221 lines

  1. # Jones 3D Cog Script
  2. #
  3. # lag_shipdoorlock.cog
  4. #
  5. # Locked Ships Rotating Door Script
  6. #
  7. # [DS]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # =======================================================================================
  12.  
  13. symbols
  14.     message    startup
  15.     message    activate    
  16.     message    blocked
  17.  
  18.        thing        door0
  19.     thing        lock0
  20.     thing        bar0
  21.     thing        indyactor
  22.     thing        campos
  23.     cog        hints            #send message when complete. 
  24.     thing        player                        local
  25.     int        open=1                        local
  26.     int        usekey                        local
  27.     int        curcam                        local
  28.     keyframe    in_activate=in_activate_medium.key        local
  29.     sound        opensnd=lag_rustydoor_c.wav            local
  30.     sound        lockturn=lag_rustydoor_key.wav        local
  31.     flex        OpenDoors                        local
  32.     flex        randwrongitemlines                local
  33.     flex        randlocklines                    local
  34.     int        speak0                        local
  35.     int        wrongitemoffset                    local
  36.     int        lockoffset                        local
  37.  
  38. # .............. INDY SAY LINES ..................................................
  39.     int    lineindex                    local # indexes sound array
  40.  
  41. # locked lines...    
  42.     sound    in_nokey0=inxj077.wav            local    # It's locked.
  43.     sound    in_nokey1=Inxj076.wav            local # This...locked-->in_sayline[18]
  44.     sound    in_nokey2=Inxj078.wav            local # Locked.
  45.     sound    in_nokey3=Inxj082.wav            local # keyhole here...just need key.
  46.     sound    in_nokey4=Inxj079.wav            local # Locked again.
  47.     sound    in_nokey5=Inxj080.wav            local # Locked...luck never changes.
  48.     sound    in_nokey6=Inxj081.wav            local # Oh no...why...always locked?
  49.     int    dl_newline=50                local
  50.     int    dl_oldline=50                local
  51.  
  52.  
  53. # wrong item...
  54.     sound    in_itemline0=Inxj089.wav        local # That didn't work.
  55.     sound    in_itemline1=Inxj090.wav        local # ...something wrong.
  56.     sound    in_itemline2=Inxj092.wav        local # Hmm...didn't quite work.
  57.     sound    in_itemline3=Inxj060.wav        local # I don't think...right answer.
  58.     sound    in_itemline4=Inxj087.wav        local # Whoops.
  59.     sound    in_itemline5=Inxj088.wav        local # Nope.
  60.     sound    in_itemline6=Inxj091.wav        local # Of course that didn't work.    
  61.     int    wi_newline=50                local
  62.     int    wi_oldline=50                local
  63.  
  64.  
  65. end
  66.  
  67. # ========================================================================================
  68.  
  69. code
  70. startup:
  71.     player = GetLocalPlayerThing();
  72.     return;
  73.  
  74. activate:
  75.     if (GetSenderRef() != lock0) return;
  76.     if(open == 0) return;
  77.     if(GetCurItem(player) == 61)            # Padlock key.
  78.     {
  79.     curCam = GetCurrentCamera();
  80.     open = 0;
  81.     SetActorFlags(player, 0x200000);
  82.     DeselectWeaponWait(player);
  83.     CopyPlayerHolsters(player, indyactor);
  84.     SetThingFlags(player, 0x80000);
  85.     ClearThingFlags(indyactor, 0x80000);
  86.     CopyOrientAndPos(indyactor, player);
  87.     StartCutscene(1);
  88.     SetCameraLookInterp(2, 0);            # turns off interp to lookthing.
  89.     SetCameraFocus(2, campos);
  90.     SetCameraSecondaryFocus(2, indyactor);
  91.     SetCurrentCamera(2);
  92.     SetCameraFOV(90, 0, 0);                # makes sure set to default.    
  93.     Sleep(0.5);
  94. PlayKey(indyactor, in_activate, 4, 0x12, 0);
  95. Sleep(0.4);
  96. usekey=PlaySoundThing(lockturn, lock0, 1.0, 4, 12, 0);
  97. WaitForSound(usekey);
  98.     DestroyThing(lock0);
  99.     ChangeInv(player, 61, -1);
  100.     PlaySoundThing(opensnd, bar0, 0.7, 4, 12, 0);
  101.     Rotate(bar0, -95, 0, 0.5);
  102.     WaitForStop(bar0);
  103.     SendMessage(hints, user3);
  104.     call OpenDoors;
  105.     return;
  106.     }
  107.     else
  108.     {
  109.         SetActorFlags(player, 0x200000);
  110.         StopThing(Player);
  111.         DeselectWeaponWait(player);
  112.         PlayKey(player, in_activate, 4, 0x12, 0);
  113.  
  114.     # player is using a wrong item
  115.           if (GetCurItem(player) >= 1)
  116.         {
  117.         sleep(0.5);
  118.         call randwrongitemlines;
  119.         }
  120.     # player isn't using anything
  121.         else
  122.         {
  123.         sleep(0.5);
  124.         call randlocklines;
  125.         }
  126.  
  127.         WaitForSound(speak0);
  128.         ClearActorFlags(player, 0x200000);
  129.         return;
  130.     }
  131.  
  132. # ........................................................................................
  133.  
  134. blocked:
  135.     Print("Door is blocked");
  136.     return;
  137.  
  138. # ........................................................................................
  139.  
  140. OpenDoors:
  141.     Rotate(door0, -70, 1, 1);
  142.     PlaySoundThing(opensnd, door0, 1.0, 4, 12, 0);
  143.     WaitForStop(door0);
  144.     DestroyThing(bar0);
  145.     Rotate(door0, -15, 2, 0.4);
  146.     WaitForStop(door0);
  147.     Rotate(door0, 10, 0, 0.4);
  148.     WaitForStop(door0);
  149.     Sleep(1.0);
  150.     EndCutscene();
  151.     SetCurrentCamera(curCam);
  152.     SetThingFlags(indyactor, 0x80000);
  153.     ClearActorFlags(player, 0x200000);
  154.     ClearThingFlags(player, 0x80000);
  155.     SetCameraLookInterp(2, 1);            #default.
  156.     return;
  157.  
  158. #=====================================================================
  159. #        Wrong Item lines
  160. #=====================================================================
  161. randwrongitemlines:
  162.  
  163.     while (wi_newline == wi_oldline)
  164.     {        
  165.         wi_newline = RandBetween(0, 19);
  166.         if (wi_newline < 15)
  167.         {    
  168.             wi_newline = RandBetween(0, 3); # ~1/5 chance for lines 0 thru 3
  169.         }
  170.         if (wi_newline == 19)
  171.         {
  172.             wi_newline = 6; # 1/20 chance for line 6 
  173.         }
  174.         if (wi_newline > 16)
  175.         {
  176.             wi_newline = 5; # 1/10 chance for line 5 
  177.         }
  178.         if (wi_newline > 14)
  179.         {
  180.             wi_newline = 4; # 1/10 chance for line 4
  181.         }
  182.     }
  183.     wi_oldline = wi_newline;    
  184.     lineindex = wrongitemoffset + wi_newline;
  185.     speak0 = PlayVoice(player, in_itemline0[lineindex], 1, 1);
  186.     return;
  187.  
  188. #=====================================================================
  189. #        Locked lines
  190. #=====================================================================
  191. randlocklines:
  192.  
  193.     while (dl_newline == dl_oldline)
  194.     {        
  195.         dl_newline = RandBetween(0, 19);
  196.         if (dl_newline < 14)
  197.         {    
  198.             dl_newline = RandBetween(0, 2); # ~1/4 chance for 0 thru 2
  199.         }
  200.  
  201.         if (dl_newline > 17)
  202.         {
  203.             dl_newline = (dl_newline - 13); # 1/20 chance for 5 or 6 
  204.         }    
  205.         if (dl_newline > 15)
  206.         {
  207.             dl_newline = 4; # 1/10 chance
  208.         }
  209.         if (dl_newline > 13)
  210.         {
  211.             dl_newline = 3; # 1/10 chance
  212.         }
  213.     }
  214.     dl_oldline = dl_newline;
  215.     lineindex = lockoffset + dl_newline;
  216.     speak0 = PlayVoice(player, in_nokey0[lineindex], 1.0, 0);
  217.     return;
  218.  
  219. end
  220.  
  221.